
<?php	
	
	class user extends database
	{
		var $connection = '';	

		function user()
		{
			parent::database();
		}
	
		function GetListPaging()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			return $sql = "Select * from vnf_user";			
			//return $pager;
			//$rs = $pager->paginate();
	//Loop through the result set
				
			/*$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;*/
		}
		
		function GetList()
		{						
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_user";			
						
			$this->setQuery($sql);
			$value = $this->loadAllRow();
			return $value;
		}
		
		function AddUser($admin_title, $username, $parent, $left, $right, $status, $activecode, 
        $main_image, $birthday, $short_description, $description, $password, $is_admin, $firstname, 
        $lastname, $email, $address, $city, $zipcode, $country, $state, $numberfone, $mobilfone
        , $fax, $gender, $registrydate, $marystatus, $height, $weight, $edu, $occupation
        , $drinking, $smoking, $aboutme, $iam, $seeking, $for, $approval, $company)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "insert into `vnf_user`(`admin_title`, `username`, `	parent`, `left`, `right`, `	status`, `activecode`, 
            `main_image`, `birthday`, `short_description`, `description`, `password`, `is_admin`, `firstname`, 
            `lastname`, `email`, `address`, `city`, `zipcode`, `country`, `state`, `numberfone`, `mobilfone`
            , `fax`, `gender`, `registrydate`, `marystatus`, `height`, `weight`, `edu`, `occupation`, `drinking`
            , `smoking`, `aboutme`, `looking`, `iam`, `seeking`, `for`, `expiration_date`, `approval`, `company`)
            values('".$admin_title."', '".$username."', '".$parent."', '".$left."', '".$right."', '".$status."', 
            '".$activecode."', '".$main_image."', '".$birthday."', '".$firstname."', 
            '".$description."', '".$password."', '".$is_admin."', '".$SortPriority."', 
            '".$lastname."', '".$email."', '".$address."', '".$city."','".$zipcode."'
            , '".$country."', '".$state."', '".$numberfone."', '".$mobilfone."','".$fax."'
            , '".$gender."', '".$registrydate."', '".$marystatus."', '".$height."','".$weight."'
            , '".$edu."', '".$occupation."', '".$drinking."', '".$smoking."','".$aboutme."'
            , '".$iam."', '".$seeking."', '".$for."', '".$approval."','".$company."')";
  
			$this->setQuery($sql);
			$this->query();
		}
		
		/*function UpdateUser1($admin_title, $username, $parent, $left, $right, $status, $activecode, 
        $main_image, $birthday, $short_description, $description, $password, $is_admin, $firstname, 
        $lastname, $email, $address, $city, $zipcode, $country, $state, $numberfone, $mobilfone
        , $fax, $gender, $registrydate, $marystatus, $height, $weight, $edu, $occupation
        , $drinking, $smoking, $aboutme, $iam, $seeking, $for, $approval, $company, $id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_user set `admin_title` =  '".$admin_title."', `username` =  '".$username."',
            `parent` =  '".$parent."', `left` =  '".$left."', `right` =  '".$right."',
            `status` =  '".$status."', `activecode` =  '".$activecode."', `main_image` =  '".$main_image."',
            `birthday` =  '".$birthday."', `short_description` =  '".$short_description."', 
            `description` =  '".$description."', `password` =  '".$password."',
            `is_admin` =  '".$is_admin."', `firstname` =  '".$firstname."', `lastname` =  '".$lastname."',
            `email` =  '".$email."', `address` =  '".$address."', `city` =  '".$city."',
            `zipcode` =  '".$zipcode."', `country` =  '".$country."', `state` =  '".$state."'
            , `numberfone` =  '".$numberfone."', `mobilfone` =  '".$mobilfone."', `fax` =  '".$fax."'
            , `gender` =  '".$gender."', `registrydate` =  '".$registrydate."', `marystatus` =  '".$marystatus."'
            , `height` =  '".$height."', `weight` =  '".$weight."', `edu` =  '".$edu."'
            , `occupation` =  '".$occupation."', `drinking` =  '".$drinking."', `smoking` =  '".$smoking."'
            , `for` =  '".$for."', `approval` =  '".$approval."', `company` =  '".$company."'";
			$sql .= " where category_id=".$id;			
			echo $sql;
			$this->setQuery($sql);
			$this->query();
		}*/
		function UpdateUser($status, $id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "";
			$sql = "Update vnf_user set `status` =  '".$status."'";
			$sql .= " where category_id=".$id;			
			echo $sql;
			$this->setQuery($sql);
			$this->query();
        }
		function GetOneUser($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Select * from vnf_user where category_id=".$id."";
			$this->setQuery($sql);
			$row = $this->loadOneRow();
			return $row;
		}
		
		function DeleteUser($id)
		{
			$this->setQuery("set names utf8");
			$this->query();
			$sql = "Delete from vnf_user";
			$sql .= " where category_id=".$id;			
			
			$this->setQuery($sql);
			$this->query();
		}
	}
?>